home *** CD-ROM | disk | FTP | other *** search
- //=============================================================================
- //
- // Copyright (C) 1995 by Paul S. McCarthy and Eric Sunshine.
- // Written by Paul S. McCarthy and Eric Sunshine.
- // All Rights Reserved.
- //
- // This notice may not be removed from this source code.
- //
- // This object is included in the MiscKit by permission from the authors
- // and its use is governed by the MiscKit license, found in the file
- // "License.rtf" in the MiscKit distribution. Please refer to that file
- // for a list of all applicable permissions and restrictions.
- //
- //=============================================================================
- //-----------------------------------------------------------------------------
- // MiscHighlightTracker.M
- //
- // Highlight-mode selection tracking.
- //
- //-----------------------------------------------------------------------------
- //-----------------------------------------------------------------------------
- // $Id: MiscHighlightTracker.M,v 1.1 95/09/27 12:21:21 zarnuk Exp $
- // $Log: MiscHighlightTracker.M,v $
- // Revision 1.1 95/09/27 12:21:21 zarnuk
- // Initial revision
- //
- //-----------------------------------------------------------------------------
- #import "MiscHighlightTracker.h"
- #import "MiscSparseSet.h"
- #import "MiscTableBorder.h"
-
-
- @implementation MiscHighlightTracker
-
- //-----------------------------------------------------------------------------
- // setLastPos:
- //-----------------------------------------------------------------------------
- - (void) setLastPos: (MiscCoord_V) pos
- {
- lastPos = pos;
- set->setCursor( pos );
- }
-
-
- //-----------------------------------------------------------------------------
- // mouseDown:atPos:
- //-----------------------------------------------------------------------------
- - (void) mouseDown: (NXEvent const*) event atPos: (MiscCoord_V) pos
- {
- extending = ((event->flags & NX_ALTERNATEMASK) != 0);
- if (extending)
- {
- [super mouseDown: event atPos: pos];
- }
- else
- {
- set->toggle( pos );
- [self setLastPos: pos];
- }
- }
-
-
- //-----------------------------------------------------------------------------
- // mouseDragged:atPos:
- //-----------------------------------------------------------------------------
- - (void) mouseDragged: (NXEvent const*) event atPos: (MiscCoord_V) pos
- {
- if (extending)
- {
- [super mouseDragged: event atPos: pos];
- }
- else
- {
- if (lastPos >= 0 && lastPos < border->count())
- set->toggle( lastPos );
- if (pos >= 0 && pos < border->count())
- set->toggle( pos );
- [self setLastPos: pos];
- }
- }
-
-
- //-----------------------------------------------------------------------------
- // mouseUp:atPos:
- //-----------------------------------------------------------------------------
- - (void) mouseUp: (NXEvent const*) event atPos: (MiscCoord_V) pos
- {
- if (extending)
- [super mouseUp: event atPos: pos];
- }
-
-
- //-----------------------------------------------------------------------------
- // keyDown:atPos:
- //-----------------------------------------------------------------------------
- - (void) keyDown: (NXEvent const*) event atPos: (MiscCoord_V) pos
- {
- set->toggle( pos );
- }
-
- @end
-